/**
 * 后台JS主入口
 */

var layer = layui.layer,
    element = layui.element(),
    laydate = layui.laydate,
    form = layui.form();

/**
 * AJAX全局设置
 */
$.ajaxSetup({
    type: "post",
    dataType: "json"
});

/**
 * 后台侧边菜单选中状态
 */
$('.layui-nav-item').find('a').removeClass('layui-this');
$('.layui-nav-tree').find('a[href*="' + GV.current_controller + '"]').parent().addClass('layui-this').parents('.layui-nav-item').addClass('layui-nav-itemed');

/**
 * 通用单图上传
 */
layui.upload({
    url: "/index.php/api/upload/upload",
    type: 'image',
    ext: 'jpg|png|gif|bmp|jpeg',
    success: function (data) {
        if (data.error === 0) {
            document.getElementById('thumb').value = data.url;
        } else {
            layer.msg(data.message);
        }
    }
});

/**
 * 通用日期时间选择
 */
$('.datetime').on('click', function () {
    laydate({
        elem: this,
        istime: true,
        format: 'YYYY-MM-DD hh:mm:ss'
    })
});

/**
 * 通用表单提交(AJAX方式)
 */
form.on('submit(*)', function (data) {
    $.ajax({
        url: data.form.action,
        type: data.form.method,
        data: $(data.form).serialize(),
        success: function (info) {
            if (info.code === 1) {
                setTimeout(function () {
                    location.href = info.url;
                }, 1000);
            }
            layer.msg(info.msg);
        }
    });

    return false;
});

/**
 * 通用批量处理（审核、取消审核、删除）
 */
$('.ajax-action').on('click', function () {
    var _action = $(this).data('action');
    layer.open({
        shade: false,
        content: '确定执行此操作？',
        btn: ['确定', '取消'],
        yes: function (index) {
            $.ajax({
                url: _action,
                data: $('.ajax-form').serialize(),
                success: function (info) {
                    if (info.code === 1) {
                        setTimeout(function () {
                            location.href = info.url;
                        }, 1000);
                    }
                    layer.msg(info.msg);
                }
            });
            layer.close(index);
        }
    });

    return false;
});

/**
 * 通用全选
 */

$('body').on('click','.check-all' ,function () {
    $(this).parents('table').find('input[type="checkbox"]').prop('checked', $(this).prop('checked'));
});

/**
 * 通用删除
 */
$('.ajax-delete').on('click', function () {
    var _href = $(this).attr('href');
    layer.open({
        shade: false,
        content: '确定删除？',
        btn: ['确定', '取消'],
        yes: function (index) {
            $.ajax({
                url: _href,
                type: "get",
                success: function (info) {
                    if (info.code === 1) {
                        setTimeout(function () {
                            location.href = info.url;
                        }, 1000);
                    }
                    layer.msg(info.msg);
                }
            });
            layer.close(index);
        }
    });

    return false;
});

/**
 * 清除缓存
 */
$('#clear-cache').on('click', function () {
    var _url = $(this).data('url');
    if (_url !== 'undefined') {
        $.ajax({
            url: _url,
            success: function (data) {
                if (data.code === 1) {
                    setTimeout(function () {
                        location.href = location.pathname;
                    }, 1000);
                }
                layer.msg(data.msg);
            }
        });
    }

    return false;
});


/**
 * 监听指定开关
 */
function changeStatus(data, type, url) {
    if (!url) {
        url = "/admin/goods/updateOnlineType";
    }
    var id = data.value;
    var status = 0;
    if (data.elem.checked == true) {
        status = 1;
    } else {
        status = 0;
    }
    $.ajax({
        type: "post",
        url: url,
        data: {
            status: status,
            id: id,
            type: type
        },
        dataType: 'json',
        success: function (data) {
            if (data.status != 1) {
                alert("修改失败");
            }
        }
    });
}

/**
 * 更改标签常用
 * @param data
 * @param url
 */
function changeUse(data, url) {
    if (!url) {
        url = "/admin/label/changeLabelUse";
    }
    var id = data.value;
    var status = 0;
    if (data.elem.checked == true) {
        status = 1;
    } else {
        status = 0;
    }
    $.ajax({
        type: "post",
        url: url,
        data: {
            status: status,
            id: id,
        },
        dataType: 'json',
        success: function (data) {
            if (data.code != 200) {
                alert("修改失败");
            }
        }
    });
}

/**
 * 更改user状态
 */
function changeUserStatus(data) {
    if (!url) {
        url = "/admin/user/changeUserStatus";
    }
    var id = data.value;
    var status = 0;
    if (data.elem.checked == true) {
        status = 1;
    } else {
        status = 0;
    }
    $.ajax({
        type: "post",
        url: url,
        data: {
            status: status,
            id: id,
        },
        dataType: 'json',
        success: function (data) {
            if (data.status != 1) {
                alert("修改失败");
            }
        }
    });
}

/**
 * 更改评论状态
 */
function changeComStatus(data, url) {
    if (!url) {
        url = "/admin/index/changeComStatus";
    }
    var id = data.value;
    var status = 0;
    if (data.elem.checked == true) {
        status = 1;
    } else {
        status = 0;
    }
    $.ajax({
        type: "post",
        url: url,
        data: {
            status: status,
            id: id,
        },
        dataType: 'json',
        success: function (data) {
            if (data.status != 1) {
                alert("修改失败");
            }
        }
    });
}

/**
 * 更改状态(首页资讯分类)
 */
function changeColumnStatus(data, type, url) {
    if (!url) {
        url = "/admin/index/updateOnlineType";
    }
    var id = data.value;
    var status = 0;
    if (data.elem.checked == true) {
        status = 1;
    } else {
        status = 0;
    }
    $.ajax({
        type: "post",
        url: url,
        data: {
            status: status,
            id: id,
            type: type
        },
        dataType: 'json',
        success: function (data) {
            if (data.status != 1) {
                alert("修改失败");
            }
        }
    });
}


/**
 * 更改排序
 */
function change_sort(type,url) {

    if (!url) {
        url = "/admin/index/updateSort";
    }
    var startval = 0;
    $(".content-box").on("focus",".content-sort-num",function () {
        var _this = $(this);
        startval = _this.val();
        _this.select();
    });
    $(".content-box").on("focusout", ".content-sort-num", function () {
        var _this = $(this);
        var endval = _this.val();
        if (endval != startval) {
            // console.log("修改");
            var id = _this.attr("altid");
            $.ajax({
                type: "post",
                url: url,
                data: {
                    sort: endval,
                    id: id,
                    type: type
                },
                dataType: 'json',
                success: function (data) {
                    if (data.code == 500) {
                        _this.val(startval);
                        alert(data.data);
                        return false;
                    }
                    window.location.reload();
                }
            });
        } else {
            // console.log("未修改");
        }
    });
}

/**
 * 更改排序
 */
function change_grade_score(url) {

    if (!url) {
        url = "/admin/grade/changeGrowGrade";
    }
    var startval = 0;
    $(".content-box").on("focus",".content-sort-num",function () {
        var _this = $(this);
        startval = _this.val();
        _this.select();
    });
    $(".content-box").on("focusout", ".content-sort-num", function () {
        var _this = $(this);
        var endval = _this.val();
        if (endval != startval) {
            var id = _this.attr("altid");
            $.ajax({
                type: "post",
                url: url,
                data: {
                    sort: endval,
                    id: id,
                },
                dataType: 'json',
                success: function (data) {
                    if (data.code == 500) {
                        _this.val(startval);
                        alert(data.data);
                        return false;
                    }
                    window.location.reload();
                }
            });
        } else {
            // console.log("未修改");
        }
    });
}




/**
 * 富文本编辑器
 */
function content_init(name) {
    var shuiying = "off";
    form.on('switch(' + name + ')', function(data){
        shuiying = data.value;
        if(data.elem.checked == true){
            shuiying = "on";

        }else{
            shuiying = "off";

        }
        synchro();
    });
    function synchro(){
        var layedit = layui.layedit;
        //监听指定开关
        layedit.set({
            uploadImage: {
                url: "/api/Fileuploadlayui/upload?shuiying=" + shuiying //接口url
                , type: 'post' //默认post
            }
        });

        index = layedit.build('content_box',{
            height: 600 //设置编辑器高度
        }); //建立编辑器
        layedit.sync(index); //同步编辑器内容到textarea
    }
    synchro();
}


function synchrobulid(){
    var layedit = layui.layedit;
    //监听指定开关
    layedit.set({
        uploadImage: {
            url: "/api/Fileuploadlayui/upload" //接口url
            , type: 'post' //默认post
        }
    });

    index = layedit.build('content_box',{
        height: 600 //设置编辑器高度
    }); //建立编辑器
    layedit.sync(index); //同步编辑器内容到textarea
}


/**
 * 联动
 */
function moveStep(data){
    // console.log(data); //得到被选中的值
    $.ajax({
        url: "/v1/api/carapi/getRelateInfo?id=" + data.value,
        type: "get",
        success: function (info) {

            if (info.code == 200) {
                var list = info.data;
                var tpl = "";
                for (var i = 0; i < list.length; i++) {
                    if(list[i].id == data.id){
                        tpl += '<option value=' + list[i].id + ' selected>' + list[i].title + '</option>';
                    }else{
                        tpl += '<option value=' + list[i].id + '>' + list[i].title + '</option>';
                    }
                }
                $("select[name='ad_choose_id']").html($(tpl));
                form.render('select');
            }
        }
    });
}


/**
 * 标签读取
 */
function newList (type){
    var id = $("#newId").val();
    if(id){
        $.ajax({
            type: "GET",
            url: "/admin/index/getLabel?id="+id + "&type=" + type, //orderModifyStatus
            dataType:"json",
            async:false,
            success: function(data){
                if(data.code == 200){
                    var tpl = "";
                    var list = data.data.label_data;
                    for(var i=0;i<list.length;i++){
                        tpl+= '<li data-name="'+list[i].name+'" data-id="'+list[i].id+'">'+list[i].name+'<em data-id="'+list[i].id+'"class="del-btn">X</em></li>';
                        if(!$("#label_ids_input").val()){
                            $("#label_ids_input").val(list[i].id);
                        }else{
                            $("#label_ids_input").val($("#label_ids_input").val() + "," + list[i].id);
                        }
                    }
                    $(".list-label-new").empty().append($(tpl));
                }else{
                    layer.msg(data.info,{time:1000,icon:5})
                }
            }
        });
    }
};
/**
 * 标签添加
 */
$(".add-label-btn").on("click",function(){
    var listLen = $(".list-label-new li");
    if(listLen.length >=3){
        layer.msg("最多添加三条咨询",{time:1000,icon:6});
        return;
    }else{
        layer.open({
            title: '添加标签',
            btn:["确定","取消"],
            content: "<div class='add-list'><p><em>*</em>标签名称:<input text='text' id='newname'/></p></div>",
            yes:function(){
                var newname_val = $("#newname").val();
                if(newname_val == ""){
                    alert("请输入标签名");
                    return;
                }
                for(var i = 0; i < $(".list-label-new li").length; i++){
                    if(newname_val == $(".list-label-new li").eq(i).attr("data-name")){
                        alert("标签重复");
                        return false;
                    }
                }
                $.ajax({
                    type: "post",
                    url: "/admin/label/saveByAjax", //orderModifyStatus
                    data:{name:newname_val},
                    dataType:"json",
                    success: function(data){
                        if(data.code == 200){
                            var listNew = $(".list-label-new li");
                            var listArr = [];
                            listArr.push(data.data.id);
                            if(listNew.length > 0){
                                for(var i=0;i<listNew.length;i++){
                                    listArr.push(parseInt($(".list-label-new li").eq(i).attr("data-id")));
                                }
                            }

                            $("#label_ids_input").val(listArr.toString());
                            if(data.code == 200){
                                layer.closeAll();
                                $(".list-label-new").append(
                                    '<li data-name="'+newname_val+'" data-id="'+data.data.id+'">'+newname_val+'<em data-id="'+data.data.id+'"class="del-btn">X</em></li>'
                                );
                            }else{
                                layer.msg(data.info,{time:1000,icon:5})
                            }
                            // debugger
                        }else{
                            layer.msg(data.info,{time:2000,icon:5})
                        }
                    }
                });
            }
        });
    }
});
/**
 * 标签删除
 */
$(".list-label-new").on("click",".del-btn",function () {
    var _this = $(this);
    var this_id = _this.parent("li").attr("data-id");//当前将删除的id
    var label_id_group = $("#label_ids_input").val().split(",");//已有的标签id
    for(var i = 0; i < label_id_group.length; i++){
        if(this_id == label_id_group[i]){
            label_id_group.splice(i, 1);
            $("#label_ids_input").val(label_id_group.toString());
            _this.parent("li").remove();
            return false;
        }
    }
});

function all_data(url,days=7) {

    $.ajax({
        url: url,
        type: "get",
        data:{days:days},
        dataType:"json",
        success: function (data) {
            caculate(data)
        }
    });
};

function caculate(res){

    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));


    option = {
        title: {
            text: '数据统计图',
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data:res.data.chinese
        },
        toolbox: {
            show: true,
            feature: {
                dataZoom: {},
                dataView: {readOnly: false},
                magicType: {type: ['line', 'bar']},
                restore: {},
                saveAsImage: {}
            }
        },
        xAxis:  {
            type: 'category',
            boundaryGap: false,
            data: res.data.all_month
        },
        yAxis: {
            type: 'value',
            axisLabel: {
                formatter: '{value}'
            }
        },
        series: res.data.all_data
    };



    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

}
window.onload = function () {

    var interface = window.location.pathname.replace('.html', '');
    var parameter = window.location.search;
    let getUrl = interface + parameter;
    !parameter ?
        getUrl += "?excel_export=1" :
        getUrl += "&excel_export=1";
    $("a:contains('导出')").attr('href', getUrl)

    $(function () {
        layui.use('laydate', function () {
            var laydate = layui.laydate;

            var start = {
                format: 'YYYY-MM-DD 00:00:00',
                min: '1900-01-01 00:00:00'
                , max: '2099-06-16 23:59:59'
                , istoday: false
                , choose: function (datas) {
                    end.min = datas; //开始日选好后，重置结束日的最小日期
                    end.start = datas //将结束日的初始值设定为开始日
                }
            };

            var end = {
                format: 'YYYY-MM-DD hh:mm:ss',
                min: laydate.now()
                , max: '2099-06-16 23:59:59'
                , istoday: false
                , choose: function (datas) {
                    start.max = datas; //结束日选好后，重置开始日的最大日期
                }
            };
            if (!!document.getElementById('LAY_demorange_s')) {
                document.getElementById('LAY_demorange_s').onclick = function () {
                    start.elem = this;
                    laydate(start);
                }
                document.getElementById('LAY_demorange_e').onclick = function () {
                    end.elem = this
                    laydate(end);
                }
            }
        });
    });

}

/**
 * 替换超链接
 */
function relpace_link() {
    $("textarea[name='synopsis']").parents(".layui-input-block").find("iframe")[0].contentWindow.document.body.onblur = function () {
        var new_content = $("textarea[name='synopsis']").parents(".layui-input-block").find("iframe")[0].contentWindow.document.body.innerHTML;
        new_content = encodeURIComponent(new_content);
        dela();
        function dela() {
            if(new_content.indexOf("%3Ca") >= 0){
                new_content = new_content.replace(/%3Ca/, "%3Cspan");
                dela();
            }else if(new_content.indexOf("%3C%2Fa%3E") >= 0){
                new_content = new_content.replace(/%3C%2Fa%3E/, "%3C%2Fspan%3E");
                dela();
            }else if(new_content.indexOf("%3Ca") < 0 && new_content.indexOf("%3C%2Fa%3E") < 0){
                new_content = decodeURIComponent(new_content);
                $("textarea[name='synopsis']").parents(".layui-input-block").find("iframe")[0].contentWindow.document.body.innerHTML = new_content;
            }
        }
    }
}

/**
 * 监听定时发布
 */
function publish_by_time() {
    form.on('checkbox(publish_by_time)', function (data) {
        if (data.elem.checked == true) {
            $("#publish_by_time_box").show();
            $("#online_time_status").hide();
        } else if (data.elem.checked == false) {
            $("#publish_by_time_box").hide();
            $("#online_time_status").show();
        }
    });
    // $("input[name='publish_time']").on("blur",function () {
    //     var _this = $(this);
    //     var now_time = parseInt(Date.parse(new Date())/1000);//系统当前时间戳
    //     var select_time = parseInt(Date.parse(new Date(_this.val().replace(/-/g, '/')))/1000);//输入时间戳
    //     console.log(new Date());
    //     console.log(new Date(_this.val().replace(/-/g, '/')));
    //     if(select_time < now_time){
    //         $("#online_time_status").find(".online_time_status_on").attr("checked",true)
    //         form.render(null, 'online_time_status');
    //     }else{
    //         $("#online_time_status").find(".online_time_status_off").attr("checked",true)
    //         form.render(null, 'online_time_status');
    //     }
    // });
}

//标签编辑
var _labeledit_bigbox = $(".labeledit-bigbox");//标签大盒子
var _labeledit_input = $(".labeledit-input");//标签输入框
function labeledit_input_resize() {
    var bigbox_width = _labeledit_bigbox.width();//标签大盒子宽度
    var label_width = 0;
    for(var i = 0; i < _labeledit_bigbox.find(".labeledit-label").length; i++){
        label_width = Math.floor(parseFloat(label_width)) + (_labeledit_bigbox.find(".labeledit-label").eq(i).width() + 28);
    }
    _labeledit_input.width(bigbox_width - label_width - 10);
}
labeledit_input_resize();
$(window).on("resize",function () {
    labeledit_input_resize();
});
function labeledit_fun() {
    _labeledit_input.on("keypress",function (e) {
        if(e.keyCode == 13){
            e.preventDefault();
            var newname_val = _labeledit_input.val();
            add_label(newname_val);
        }
    });
    $(".labeledit-bigbox").on("click",".labeledit-label-close",function () {
        var _this = $(this);
        var this_id = _this.parents(".labeledit-label").attr("data-id");
        var input_id = $("#label_ids_input").val();
        var input_id_group = input_id.split(",");
        for(var i = 0 ; i < input_id_group.length; i++){
            if(this_id == input_id_group[i]){
                input_id_group.splice(i,1);
                $("#label_ids_input").val(input_id_group.toString());
                _this.parents(".labeledit-label").remove();
                labeledit_input_resize();
                return false;
            }
        }
    });
}

function add_label(name) {
    var newname_val = name;
    if(_labeledit_bigbox.find(".labeledit-label").length >= 3){
        layer.msg("标签不能多于3个",{time:2000,icon:5})
        return false;
    }
    if(newname_val){
        for(var i = 0; i < _labeledit_bigbox.find(".labeledit-label").length; i++){
            if(newname_val == _labeledit_bigbox.find(".labeledit-label").eq(i).find(".labeledit-label-word").text()){
                // alert("标签重复");
                layer.msg("标签重复",{time:2000,icon:5})
                return false;
            }
        }
        $.ajax({
            type: "post",
            url: "/admin/label/saveByAjax", //orderModifyStatus
            data:{name:newname_val},
            dataType:"json",
            success: function(data){
                if(data.code == 200){
                    _labeledit_input.before(
                        '<div class="labeledit-label" data-id="' + data.data.id + '">' +
                        '<div class="labeledit-label-word">' + newname_val + '</div>' +
                        '<div class="labeledit-label-close">×</div>' +
                        '</div>'
                    );
                    if($("#label_ids_input").val()){
                        $("#label_ids_input").val($("#label_ids_input").val() + ',' + data.data.id);
                    }else{
                        $("#label_ids_input").val(data.data.id);
                    }
                    _labeledit_input.val("");
                    labeledit_input_resize();
                }else{
                    layer.msg(data.info,{time:2000,icon:5})
                }
            }
        });
    }else{
        alert("请输入标签名");
        return;
    }
}

function read_label (type){
    var id = $("#newId").val();
    if(id){
        $.ajax({
            type: "GET",
            url: "/admin/index/getLabel?id="+id + "&type=" + type, //orderModifyStatus
            dataType:"json",
            async:false,
            success: function(data){
                if(data.code == 200){
                    var list = data.data.label_data;
                    for(var i = 0; i < list.length; i++){
                        _labeledit_input.before(
                            '<div class="labeledit-label" data-id="' + list[i].id + '">' +
                            '<div class="labeledit-label-word">' + list[i].name + '</div>' +
                            '<div class="labeledit-label-close">×</div>' +
                            '</div>'
                        );
                        if(!$("#label_ids_input").val()){
                            $("#label_ids_input").val(list[i].id);
                        }else{
                            $("#label_ids_input").val($("#label_ids_input").val() + "," + list[i].id);
                        }
                        labeledit_input_resize();
                    }
                }else{
                    layer.msg(data.info,{time:1000,icon:5})
                }
            }
        });
    }
};

//获取地址栏参数
function getUrlVars(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?')+1).split('&');
    for(var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}
//后台数据排序箭头
function arrow_sort() {
// "all_read" => 3
// "all_read_people" => 3
// "collect_num" => 0
// "share_num" => 0
// "comment_num" => 0
// "stay_time" => 20
//sort => asc/desc
    var href_sort_type = getUrlVars().sort_type;
    var href_sort_calu = getUrlVars().sort_calu;
    if(href_sort_type){
        for(var i = 0; i < $(".caculate-arrow").length; i++){
            if(href_sort_type == $(".caculate-arrow").eq(i).attr("data-name")){
                if(href_sort_calu == "desc"){
                    $(".caculate-arrow").eq(i).append('<i class="layui-icon">&#xe625;</i>');
                }else if(href_sort_calu == "asc"){
                    $(".caculate-arrow").eq(i).addClass("caculate-arrow-rotate");
                    $(".caculate-arrow").eq(i).append('<i class="layui-icon">&#xe625;</i>');
                }
                // return false;
            }
        }
    }
    $(".caculate-arrow-box").on("click",".caculate-arrow",function () {
        var _this = $(this);
        // console.log(location);
        var this_sort_type = _this.attr("data-name");
        var this_sort_calu = "desc";
        if(this_sort_type == href_sort_type){
            this_sort_calu = "asc";
        }else{
            this_sort_calu = "desc";
        }
        if(location.search){
            var jump_href_before = location.origin + location.pathname;
            var jump_href_after = "";
            var jump_href = "";
            if(href_sort_type && href_sort_calu){
                for(var i = 0; i < getUrlVars().length; i++){
                    if(getUrlVars()[i] == "sort_type"){
                        if(jump_href_after.length > 0){
                            jump_href_after = jump_href_after + "&sort_type=" + this_sort_type;
                        }else{
                            jump_href_after = "?sort_type=" + this_sort_type;
                        }
                    }else if(getUrlVars()[i] == "sort_calu"){
                        if(jump_href_after.length > 0){
                            jump_href_after = jump_href_after + "&sort_calu=" + this_sort_calu;
                        }else{
                            jump_href_after = "?sort_calu=" + this_sort_calu;
                        }
                    }else{
                        if(jump_href_after.length > 0){
                            jump_href_after = jump_href_after + "&" + getUrlVars()[i] + "=" + getUrlVars()[getUrlVars()[i]];
                        }else{
                            jump_href_after = "?" + getUrlVars()[i] + "=" + getUrlVars()[getUrlVars()[i]];
                        }
                    }
                }
                jump_href = jump_href_before + jump_href_after;
            }else{
                jump_href = location.href + "&sort_type=" + this_sort_type + "&sort_calu=" + this_sort_calu;
            }
            window.location.href = jump_href;
        }else{
            window.location.href = location.href + "?sort_type=" + this_sort_type + "&sort_calu=" + this_sort_calu;
        }
    });
}

/**
 * 根据输入传头像
 * @param obj
 * @param img_url
 * @param img_input
 */
function getImgByName(obj, img_url = 'imgUrl', img_input = 'img') {
    var name = obj.val();//作者
    $.ajax({
        type: "get",
        url: "/admin/index/getImgByName",
        data: {
            name: name,
        },
        dataType: 'json',
        success: function (data) {

            if (data.code == 200) {
                $('.img-photo').show();

                document.getElementById(img_input).value = data.data.img_url;
                document.getElementById(img_url).src = data.data.img_url;
            } else {
                $('.img-photo').hide();
                document.getElementById(img_input).value = "";
                document.getElementById(img_url).src = "";
            }
        }
    });

}
//常用标签
function labelUsuallyUse() {
    $(".label_usually_use_box").on("click",".label_usually_use",function () {
        var _this = $(this);
        var label_val = _this.text();//获取点击标签的内容
        add_label(label_val);
    });
}
